<?php
/**
 Tela de confirma��o para a altera��o de um Fonte.
 */
if( !function_exists('__autoload') )
{
    function __autoload($class_name) {
    require_once $class_name . '.php';
    }
}


// dados do Programa vindos de AlterarFonte.php
$anoId 		  = $_POST['anoId'];
$programaId   = $_POST['programas'];
$a = new Ano();
$ano = $a->CarregarAno( $anoId );
$p = new Programa();
$programa = $p->CarregarPrograma( $programaId );
$fonte = new Fonte();
$result = $fonte->CarregarFontes( $programaId );
for($i=0;$i<sizeof($result);$i++){
	$fonteId[$i]	  	 = $_POST['fonteId'.$i];
	$fonteRecurso[$i] 	 = $_POST['fonteRecurso'.$i];
	$tipoDespesa[$i]  	 = $_POST['tipoDespesa'.$i];
	$fonteValor[$i]   	 = $_POST['fonteValor'.$i];
	$fonteSaldo[$i]   	 = $_POST['fonteSaldo'.$i];
	$valorSuplemento[$i] = $_POST['supValor'.$i];
	$opcao 				 = $_POST['listaOpcao'.$i];
	if($opcao == 1){
		$tipoOpcao[$i] = "Suplemento";
	} else if ($opcao == 2){
		$tipoOpcao[$i] = "Cancelamento";
	}
}
?>
<html>
           <head>
           <title>SAEO - Confirmar Suplementa&ccedil;&atilde;o/Cancelamento</title>
           <link rel='stylesheet' type='text/css' href='templates/estilos.css'>
           </head>
     <body class='body'>
     <form name='confirmar_cadastro_suplemento' action='EnviarDadosFonte.php?operacao=4' method='post'>
     <input type='hidden' name='programaId' value='<?php echo $programaId ?>'>
     <table width='779' border='0' cellspacing='0' cellpadding='0' align='center' bgcolor='#FFFFFF'>
            <tr>
				<td colspan='2'><?php include "Topo.php"; ?></td>
			</tr>
            <tr>
                <td><div class='titulosTabelas' style='width:779; height:20; background:url(templates/tabela.JPG)'>CONFIRMAR SUPLEMENTA&Ccedil;&Atilde;O/CANCELAMENTO</div></td>
            </tr>
            <tr>
                <td colspan='2'>&nbsp;</td>
            </tr>
            <tr>
                <td><table class='tabela' width='650' border='0' cellspacing='0' cellpadding='0' align='center' bgcolor='#FFFFFF'>
                           <tr>
                               <td>&nbsp;</td>
                           </tr>
                           <tr>
                           		<td class='textoTabelas' width='30%'>&nbsp;Ano:</td>
                           		<td class='textoTabelas'><?php echo $ano->ano; ?> </td>
                           		<input type='hidden' name='programaId' value='<?php echo $anoId; ?>' />
                           </tr>
                           <tr>
                               <td>&nbsp;</td>
                           </tr>                           
                           <tr>
                           		<td class='textoTabelas' width='30%'>&nbsp;Programa:</td>
                           		<td class='textoTabelas'><?php echo $programa->nome; ?> </td>
                           		<input type='hidden' name='programaId' value='<?php echo $programaId; ?>'/>
                           </tr>
                           <tr>
                               <td>&nbsp;</td>
                           </tr>                                                      
                           <?php
                           	$tam = sizeof($result);
                           	for($i=0;$i<sizeof($result);$i++){
                           		$tipoDesp =($tipoDespesa[$i] == 33)?"33 - Corrente" : "44 - Capital";
                           		echo"
                           			<tr>
                           				<td class='textoTabelas' width='30%'>&nbsp;Fonte de Recurso:</td>
                           				<td class='textoTabelas'>$fonteRecurso[$i] </td>
                           				<input type='hidden' name='fonteId$i' value='$fonteId[$i]'/>
                           				<input type='hidden' name='fonteRecurso$i' value='$fonteRecurso[$i]'>
                           			</tr>
                           			<tr>
                               		  <td colspan='2'>&nbsp;</td>
                           			</tr>                     
                           			<tr>
                           				<td class='textoTabelas' width='30%'>&nbsp;Tipo de Despesa:</td>
                           				<td class='textoTabelas'> $tipoDesp</td>
                           				<input type='hidden' name='tipoDespesa$i' value='$tipoDespesa[$i]'>
                           			</tr>
                           			<tr>
                               			<td colspan='2'>&nbsp;</td>
                           			</tr>                           			
                           			<tr>
                           				<td class='textoTabelas' width='30%'>&nbsp;Valor:</td>
                           				<td class='textoTabelas'>R$&nbsp;$fonteValor[$i]</td>
                           				<input type='hidden' name='fonteValor$i' value='$fonteValor[$i]'>
                           			</tr>
                           			<tr>
                               			<td colspan='2'>&nbsp;</td>
                           			</tr>                           			                           			
                           			<tr>
                           				<td class='textoTabelas' width='30%'>&nbsp;Valor apos o ".$tipoOpcao[$i].":</td>
                           				<td class='textoTabelas'>R$&nbsp;$valorSuplemento[$i]</td>
                           				<input type='hidden' name='valorSuplemento$i' value='$valorSuplemento[$i]'>
                           			</tr>";                           			
                           	if($i!= $tam-1 ){
                           			echo"<tr>
                               				<td colspan='2' class='traco'>&nbsp;</td>
                           				</tr>
                           			<tr>
                               			<td colspan='2'>&nbsp;</td>
                           			</tr>";                           			
                           			}                           		
                           	} 
                           ?>                           
                           <tr>
                               <td colspan='2'>&nbsp;</td>
                           </tr>
                           <tr>
                               <td colspan='2' height='46'><div style='position:relative;left:220px'><img style='width:100px;height:30px;cursor:pointer;' src='templates/btvoltar.JPG' onclick='javascript: history.go(-1);'>&nbsp;
                               <input type='image' style='width:100px;height:30px;' src='templates/btalterar.JPG'/></div></td>
                           </tr>
                     </table>
                </td>
            </tr>
            <tr>
                <td>&nbsp;</td>
            </tr>
            <tfoot>
           <tr>
                <td colspan='2'>&nbsp;</td>
            </tr>
                   <tr> 
					<?php include 'rodapeCreditos.php'; ?>
				   </tr>
            </tfoot>
     </table>
     </form>
     </body>
     </html>